package com.pro.controller;

import com.pro.pojo.JsComment;
import com.pro.pojo.JsonData;
import com.pro.service.JsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author 祖铭泽
 * @Date 2022/1/14/0014
 * @description 评论 控制层
 */
@Controller
@RequestMapping(value = "/comment")
public class JsCommentController {
    @Autowired
    private JsCommentService jsCommentService;
    /**
     * @Author 祖铭泽
     * @Date 2022/1/14/0014
     * @description 根据课程id和课程类型 查询所有课程评论
     */
    @RequestMapping(value = "/getAllCourseComments")
    @ResponseBody
    public JsonData getAllCourseComments(JsComment jsComment){
        return jsCommentService.getAllCourseComments(jsComment);
    }
    /**
     * @Author 祖铭泽
     * @Date 2022/1/14/0014
     * @description 根据评论id更改显示状态
     */
    @RequestMapping(value = "/updateCommentDisplayById")
    @ResponseBody
    public JsonData updateCommentDisplayById(JsComment jsComment) {
        return jsCommentService.updateCommentDisplayById(jsComment);
    }
    /**
     * @Author 祖铭泽
     * @Date 2022/1/14/0014
     * @description 根据评论id更改评论状态
     */
    @RequestMapping(value = "/updateCommentStatusById")
    @ResponseBody
    public JsonData updateCommentStatusById(JsComment jsComment) {
        return jsCommentService.updateCommentStatusById(jsComment);
    }
    /**
     * @Author 祖铭泽
     * @Date 2022/1/14/0014
     * @description 发表评论
     */
    @RequestMapping(value = "/addComment")
    @ResponseBody
    public JsonData addComment(JsComment jsComment) {
        return jsCommentService.addComment(jsComment);
    }
}
